﻿<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>会话列表</title>
        <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport"/>
        <meta content="yes" name="apple-mobile-web-app-capable"/>
        <meta content="black" name="apple-mobile-web-app-status-bar-style"/>
        <meta content="telephone=no" name="format-detection"/>
        <link href="/css/style.css" rel="stylesheet" type="text/css"/>
        <script src="/js/jquery/jquery.min.js"></script>
        <script type="text/javascript" src="/js/bootstrap/js/bootstrap.min.js"></script>
        <script src="/js/plugins/jrender/jrender.min.js"></script>
        <script src="/js/plugins/jquery-form/jquery.form.js"></script>
        <link rel="stylesheet" href="/js/plugins/dialog2/dialog.css">
        <script src="/js/plugins/dialog2/dialog.min.js"></script>
        <script>
            $(function () {
                var userStr = sessionStorage.getItem("user");
                var user = JSON.parse(userStr);
                var currentPage=1;
                var totalPage=0;
                var dataList=[];
                function queryForSenderByGetterId() {
                    $.get("/personalmessages/"+user.id,{getterId:user.id,currentPage:currentPage,pageSize:3},function (data) {
                        console.log(data);
                        $.merge(dataList,data.list)
                        $("#personalMess").renderValues({list:dataList},{
                            setClass:function (item, value) {
                                console.log(value);
                                if (value==0) {
                                    $(item).addClass("aui-badge")
                                }
                            },
                            setHref:function (item, value) {

                                $(item).attr("href",$(item).data("href")+value)
                            }
                        })
                        currentPage+=1;
                        totalPage=data.pages;
                    })
                }
                queryForSenderByGetterId();
                $(window).scroll(function () {
                    if($(window).height()+$(window).scrollTop()>=$(document).height()){
                        //console.log($(window).height());console.log($(window).scrollTop());console.log($(document).height());
                        //判断当前页是否小于等于总页数
                        if(currentPage<=totalPage){
                            queryForSenderByGetterId();
                        }
                        else{
                            $(document).dialog({
                                type : 'notice',
                                infoText: '亲.我也是有限度的',
                                autoClose: 2500,
                                position: 'bottom'  // center: 居中; bottom: 底部
                            });
                        }
                    }
                })
            })
        </script>
    </head>
    <body>

        <!--

         * 17素材vip建站专区模块代码
         * 详尽信息请看官网：http://www.17sucai.com/pins/vip
         *
         * Copyright , 温州易站网络科技有限公司版权所有
         *
         * 请尊重原创，未经允许请勿转载。
         * 在保留版权的前提下可应用于个人或商业用途

        -->

        <section class="aui-flexView">
            <header class="aui-navBar">
                <a href="message.html">
                    <i class="icon"><</i>
                </a>
                <div class="aui-center">
                    <span class="aui-center-title">私信</span>
                </div>
               
            </header>
            <section class="aui-scrollView">
                <div class="aui-search">
                    <div class="aui-search-box">
                        <input type="text" placeholder="搜索">
                        <span class="aui-search-box-search">
                            <i class="icon icon-search"></i>
                        </span>
                        <span class="aui-search-box-voice">
                            <i class="icon icon-voice"></i>
                        </span>
                    </div>
                </div>
                <div class="aui-flex-list" id="personalMess">
                    <div render-loop="list">
                    <a data-href="/mine/chatpage.html?id=" class="aui-flex-list-item" render-fun="setHref" render-key="list.sender.id">
                        <div class="aui-flex-list-image">
                            <img render-src="list.sender.headImgUrl">
                            <span class="unreadClass" render-fun="setClass" render-key="list.state" ></span>
                            <!--class="aui-badge"-->
                        </div>
                        <div class="aui-flex-list-text">
                            <h4 render-html="list.sender.nickName"></h4>
                            <p render-html="list.content"></p>
                        </div>
                        <span class="aui-flex-list-right" render-html="list.createTime"></span>
                    </a>
                    </div>
                </div>
            </section>

        </section>


    </body>
</html>
